<?php
// +----------------------------------------------------------------------
// | SwiftPHP [ JUST DO ONE THING WELL ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2017  http://swiftphp.zhongwenyu.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: zhongwenyu <zhongwenyu1987@163.com> <http://www.zhongwenyu.com>
// +----------------------------------------------------------------------
// | Times: 2017/2/23 10:27
// +----------------------------------------------------------------------
namespace swift;

class File{
    /**
     * 获取指定目录的文件列表
     * @params string $path
     * @return array
     */
    public static function get_file_list($path){
        if(is_dir($path)){
            $arr = [];
            if($dh = opendir($path)){
                while(($file = readdir($dh)) != false){
                    if($file != '.' && $file != '..'){
                        $arr[] = $file;
                    }
                }
            }
            closedir($dh);
            return $arr;
        }
    }
}
